﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FFWorker
{
    public class ActionArbiter
    {
        private Dictionary<String, Object> Actions;

        public ActionArbiter()
        {
            Actions = new Dictionary<String, Object>();
        }

        public void RegisterAction(String Key, Object Action)
        {
            Actions.Add(Key, Action);
        }

        public void ActivateAction(String Id)
        {
            Object ActionNonCasted;
            ActionBaseClass Action;

            foreach (KeyValuePair<string, Object> Act in Actions)
            {
                ActionNonCasted = Act.Value;
                Action = (ActionBaseClass)ActionNonCasted;
                Action.Deactivation();
            }

            ActionNonCasted = Actions[Id];
            Action = (ActionBaseClass)ActionNonCasted;
            Action.Activation();
        }
    }
}
